/**   
 * @Title: MyAndroidHttpTransport.java 
 * @Package com.esun.cheetah.network
 * @Description: 通讯
 * @author 程相亭 <br/>
 * @date 2012-03-15 下午05:07:33  
 * Copyright (C) 2011 Shenzhen E-sun Sky Net Technology Co.,ltd.
 */
package com.esun.cheetah.network;

import java.io.IOException;

import org.ksoap2.transport.HttpTransportSE;
import org.ksoap2.transport.ServiceConnection;

import com.esun.cheetah.config.Config;
import com.esun.util.log.EDebug;

/**
 * @ClassName: MyAndroidHttpTransport
 * @Description:通讯类
 * @author 程相亭 <br/>
 * @date 2012-03-15 下午05:07:33
 */
public class EsunAndroidHttpTransport extends HttpTransportSE {

	// 默认超时时间为10s
	private int timeoutConn = Config.TIME_OUT_DEFAULT;
	private int timeoutRead = Config.TIME_OUT_DEFAULT;

	public EsunAndroidHttpTransport(String url) {
		super(url);
	}

	public EsunAndroidHttpTransport(String url, int timeoutConn, int timeoutRead) {
		super(url);
		this.timeoutConn = timeoutConn;
		this.timeoutRead = timeoutRead;
	}

	/**
	 * @Title: getServiceConnection
	 * @Description: 为ServiceConnectionSE设置超时
	 * @param
	 * @return ServiceConnection 设置超时后的ServiceConnection
	 * @throws
	 */
	@Override
	protected ServiceConnection getServiceConnection() throws IOException {
		ServiceConnectionSE serviceConnection = new ServiceConnectionSE(url);
		serviceConnection.setConnectionTimeOut(this.timeoutConn,
				this.timeoutRead);
		EDebug.o("设置链接超时时间 " + this.timeoutConn + "秒。。。。。。。。");
		EDebug.o("设置读取内容超时时间 " + this.timeoutRead + "秒。。。。。。。。");
		return serviceConnection;
	}

}
